package cz.muni.fi.pv112.cranesimulator.models.crane.parts;

import cz.muni.fi.pv112.cranesimulator.models.OBJModel;

/**
 *
 * @author Michal Ďuriš
 */
public class LiftingRod extends OBJModel {

    private float extension = 1.0f;
    private float extensionStep = 0.01f;

    private float topBaseVerticalIncrease = 0.0f;
    private float lengthIncrease = 0.0f;

    public static final float EXTENSION_MIN_VALUE = 1.0f;
    public static final float TOP_BASE = 195.0f;
    public static final float BOTTOM_BASE = 115.0f;
    public static final float LENGTH_WITH_NO_EXTENSION = TOP_BASE - BOTTOM_BASE;

    public LiftingRod() {
        super();

        path = "/cz/muni/fi/pv112/cranesimulator/resources/models/crane/parts/lifting rod.obj";
    }

    public float getExtension() {
        return extension;
    }

    public void setExtension(float extension) {
        this.extension = extension;
    }

    public float getExtensionStep() {
        return extensionStep;
    }

    public void setExtensionStep(float extensionStep) {
        this.extensionStep = extensionStep;
    }

    public void increaseExtension() {
        extension += extensionStep;
    }

    public boolean decreaseExtension() {
        if (extension == EXTENSION_MIN_VALUE) {
            return false;
        }

        extension -= extensionStep;

        if (extension < EXTENSION_MIN_VALUE) {
            extension = EXTENSION_MIN_VALUE;
        }

        return true;
    }

    public float getTopBaseVerticalIncrease() {
        return topBaseVerticalIncrease;
    }

    public void setTopBaseVerticalIncrease(float topBaseVerticalIncrease) {
        this.topBaseVerticalIncrease = topBaseVerticalIncrease;
    }

    public float getLengthIncrease() {
        return lengthIncrease;
    }

    public void setLengthIncrease(float lengthIncrease) {
        this.lengthIncrease = lengthIncrease;
    }

}
